package com.liangzhong.model.footballLottery.vo
{
	import com.common.stdlib.DateUtil;
	import com.liangzhong.model.AppData;

	/**
	 *竞猜vo 
	 * @author lake
	 * 
	 */	
	public class FbLotteryVo
	{
		/**
		 *球队1名字 
		 */		
		public var teamName1 		:String;
		/**
		 *球队2名字 
		 */		
		public var teamName2		:String;
		/**
		 *竞猜id 
		 */		
		public var gid				:int;
		/**
		 *竞猜标题 
		 */		
		public var title			:String;
		/**
		 *竞猜时间
		 */		
		public var endDateStr		:String;
		/**
		 *1为竞猜中，2为已截止，3为已派奖 
		 */		
		public var status			:int;
		/////////////////////我的竞猜 信息/////////////////////
		/**
		 *下注金额 
		 */		
		public var amt				:int;
		/**
		 *选项
		 * 1 主队胜 
		 * 2 和 
		 * 3 客队胜 
		 */		
		public var choice			:int;
		/**
		 *赔率 
		 */		
		public var rate				:Number;
		/**
		 *结果 
		 *赛后结果，0为结果未出，1为主队胜，2为两队打平，3为客队胜
		 */		
		public var result			:int;
		/**
		 *是否已发奖
		 * 0 否
		 * 1 是 
		 */		
		public var award			:int;
		/**
		 *竞猜内容 
		 */		
		public var guessDetail 		:GuessDetailVo = new GuessDetailVo();
		
		public function FbLotteryVo()
		{
		}
		/**
		 *解析数据 
		 * @param data
		 * 
		 */		
		public function parse(data :Object):void
		{
			gid = data.gid;
			title = data.title;
			endDateStr = data.edate;
			status = data.status;
		}
		/**
		 *解析我的竞猜信息 
		 * 
		 */		
		public function parseMyGuessInfo(data :Object):void
		{
			gid = data.gid;
			teamName1 = data.hname;
			teamName2 = data.gname;
			title = data.title;
			endDateStr = data.edate;
			amt = data.amt;
			choice = data.choice;
			rate = data.rate;
			result = data.result;
			award = data.award;
			if(award == 1)
			{
				status = 3;
			}
			else
			{
				var tempDate :Date = DateUtil.tranDateStrToDate(endDateStr);
				if(DateUtil.compareTwoDate(AppData.getInstance().curDate,tempDate))
				{
					status = 2;
				}
				else
				{
					status = 1;
				}
			}
		}
		/**
		 *获取我的竞猜描述 
		 * @return 
		 * 
		 */
		public function get guessStr():String
		{
			var info :String = "";
			switch(choice)
			{
				case 1:
				{
					info = teamName1 + "胜";
					break;
				}
				case 2:
				{
					info = "两队平";
					break;
				}
				case 3:
				{
					info = teamName2 + "胜";
					break;
				}
			}
			return info;
		}
		/**
		 *获取比赛状态 
		 * @return 
		 * 
		 */
		public function get statusStr():String
		{
			var info :String = "";
			switch(result)
			{
				case 0:
				{
					info = "比赛中";
					break;
				}
				case 1:
				{
					info = teamName1 + "胜";
					break;
				}
				case 2:
				{
					info = "两队平";
					break;
				}
				case 3:
				{
					info = teamName2 + "胜";
					break;
				}
			}
			return info;
		}
		/**
		 *获取奖金描述 
		 * @return 
		 * 
		 */		
		public function get awardStr():String
		{
			var info :String = "";
			var awardCount :int = 0;
			if(choice == result)
			{
				awardCount = amt * rate;
			}
			return info + awardCount;
		}
	}
}